package org.itzheng.itplayer.adapter

import android.view.View
import android.view.ViewGroup
import org.itzheng.and.baseutils.common.StrUtils
import org.itzheng.itplayer.R
import org.itzheng.itplayer.adapter.viewholder.ViewHolder
import org.itzheng.itplayer.bean.VideoFolder
import org.itzheng.itplayer.bean.VideoInfo
import org.itzheng.itplayer.databinding.AdapterVideoListPreviewBinding
import org.itzheng.ui.ViewShowUtils
import org.vetc.mgr.adapter.viewholder.VHKotlinAdapter

/**
 * Title:<br></br>
 * Description: <br></br>
 *
 * @email ItZheng@ZoHo.com
 * Created by itzheng on 2020-12-4.
 */
class FolderListPreviewAdapter : VHKotlinAdapter() {
    override fun onCreateView(parent: ViewGroup, viewType: Int): View {
        return inflate(parent, R.layout.adapter_video_list_preview)
    }

    override fun onBindViewHolder(holder: ViewHolder, position: Int) {
        val item = getItem(position) as VideoFolder
        var binding = AdapterVideoListPreviewBinding.bind(holder.itemView);
        binding.tvTitle.setText(ViewShowUtils.getFolderName(item.fName))
        binding.tvDuration.setText("${item.fContent.size}")
        ViewShowUtils.showFolderIcon(binding.ivIcon, item)
    }
}